<template>
  <!--重点企业画像主页-->
  <div class="corporate-tab-switch">
    <top-tab-block :companyId="companyId" :flag="this.$route.query.flag"></top-tab-block>
    <div class="viewBox">
      <template v-if="$route.name === '企业业务往来分析'">
        <router-view></router-view>
      </template>
      <content-block
        v-else
        :title="companyName"
        :tabIndex="tabIndex"
        :isbackBtn="false"
        :height="tabIndex === 3 || tabIndex === 0 ? 'auto' : '81vh'"
      >
        <template>
          <router-view></router-view>
        </template>
      </content-block>
    </div>
  </div>
</template>

<script>
export default {
  name: "corporate-tab-switch",
  components: {
    ContentBlock: () => import("@/components/contentbg-block"),
    TopTabBlock: () => import("@/components/topTab-block")
  },
  props: {},
  data() {
    return {
      tabIndex: Number(this.$route.query.tabIndex) || 0,
      companyName: "",
      companyId: this.$route.query.companyId || 1
    };
  },
  computed: {},
  created() {},
  mounted() {
    this.companyName =
      sessionStorage.getItem("companyName") +
      (this.tabIndex === 0
        ? "画像"
        : this.tabIndex === 1
        ? "信用评估"
        : this.tabIndex === 2
        ? "商业谱系"
        : this.tabIndex === 3
        ? "业务往来分析"
        : "");
  },
  methods: {}
};
</script>

<style scoped lang="scss">
.corporate-tab-switch {
  width: 100%;
  min-height: 100%;
  padding: 1.85vh 1.3vw;
  box-sizing: border-box;

  .viewBox {
    // margin-bottom: 2.1vh
  }
}
</style>
